#ifndef __CRITICALSECTION_H__
#define __CRITICALSECTION_H__

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include "CommonDef.h"


	
class CCriticalSection 
{
public:
	CCriticalSection( DWORD dwSpinCount = 0 );
	virtual ~CCriticalSection();

	void Lock();
	void Unlock(void);
	
private:
	CRITICAL_SECTION m_cs;
	
};


class CSyncCriticalSection
{
public:
	CSyncCriticalSection( CCriticalSection & cs );
	virtual ~CSyncCriticalSection();

	void Lock();
	void Unlock(void);
	
private:
	BOOL m_bLocked;
	CCriticalSection & m_cs;
	
	__DISABLE_COPY(CSyncCriticalSection);
};






#endif // __CRITICALSECTION_H__
